import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:sph_shipper/http/NoLoadingGetApi.dart';

import '../../AppConfig/Config.dart';
import '../../l10n/messages.dart';

class BillingDetails extends StatefulWidget {
  const BillingDetails({super.key, required this.dataMap});
  final Map dataMap;
  @override
  State<BillingDetails> createState() => _BillingDetailsState();
}

class _BillingDetailsState extends State<BillingDetails> {

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    // getBillDetail();
  }
  void getBillDetail(){
    NoLoadinggetApiManager.getData(
      context, // 上下文对象，用于显示提示信息等
      'api/pay/wallet/shipper/bill/detail', // 您的API端点
      {"id":widget.dataMap['id']}, // 查询参数，如果没有可以传递null
          (responseData)  {
        setState(() {


        });
      },
    );
  }
  Widget build(BuildContext context) {
    var messages = AppLocalizations.of(context)!;
    final screenSize = MediaQuery.of(context).size;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.arrow_back_ios, color: Colors.black),
          onPressed: () => Navigator.of(context).pop(),
        ),
        backgroundColor: Colors.white,
        centerTitle: true,
        title: Text(messages['账单详情'],style: TextStyle(color: Colors.black,fontWeight: FontWeight.w300,fontSize: 16.sp),),
      ),
      body:ListView(
        children: [
          Container(

            color: Colors.white,
            padding: EdgeInsets.only(top: 30.h,bottom: 30.h),
            child: Column(
              children: [
                // Image.asset("lib/Images/PersonCenter/账单退款icon.png",width: 40.w,height: 40.h,),
                // SizedBox(height: 10.h,),
                Text("("+(widget.dataMap['type']=="DEPOSIT"?"订金":widget.dataMap['type']=="FREIGHT"?"运费":
                widget.dataMap['type']=="TECHNOLOGY"?"技术服务费":widget.dataMap['type']=="PREMIUM"?"保险费":"油费")+")"+widget.dataMap['productDesc'],style: TextStyle(color: Colors.black,fontSize: 16.sp,)),
                SizedBox(height: 15.h,),
                Text(((widget.dataMap['category']=="IN"||widget.dataMap['category']=="INCOME"||widget.dataMap['category']=="REFUND")?"+":"-")+widget.dataMap['amount'],style: TextStyle(color: Colors.black,fontSize: 28.sp),),
                Text(widget.dataMap['status']=="00"?"处理中":widget.dataMap['status']=="01"?"交易中":widget.dataMap['status']=="02"?"交易成功":
                widget.dataMap['status']=="03"?"交易失败":"交易未知",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
              ],
            ),
          ),
          SizedBox(height: 8.h,),
          Container(

            color: Colors.white,
            padding: EdgeInsets.only(left: 10.w,right: 10.w,top: 10.h,bottom: 10.h),
            child: Column(
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text("商品",style: TextStyle(color:MyColors.textColor,fontSize: 13.sp),),
                      Text("["+(widget.dataMap['type']=="DEPOSIT"?"订金":widget.dataMap['type']=="FREIGHT"?"运费":
                      widget.dataMap['type']=="TECHNOLOGY"?"技术服务费":widget.dataMap['type']=="PREMIUM"?"保险费":"油费")+((widget.dataMap['category']=="IN"||widget.dataMap['category']=="INCOME"||widget.dataMap['category']=="REFUND")?"收入":"支出")+"]"+widget.dataMap['productDesc'],style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                    ],
                ),
                // SizedBox(height: 10.h,),
                // Row(
                //   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                //   children: [
                //     Text("商品描述",style: TextStyle(color:MyColors.textColor,fontSize: 13.sp),),
                //     Text(widget.dataMap['productDesc']+"["+(widget.dataMap['type']=="DEPOSIT"?"订金":widget.dataMap['type']=="FREIGHT"?"运费":
                //     widget.dataMap['type']=="TECHNOLOGY"?"技术服务费":widget.dataMap['type']=="PREMIUM"?"保险费":"油费")+((widget.dataMap['category']=="IN"||widget.dataMap['category']=="INCOME"||widget.dataMap['category']=="REFUND")?"收入":"支出")+"]",style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                //   ],
                // ),
                // SizedBox(height: 10.h,),
                // Row(
                //   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                //   children: [
                //     Text("原交易单号",style: TextStyle(color:MyColors.textColor,fontSize: 13.sp),),
                //     Text(widget.dataMap['serialNum']!=null?widget.dataMap['serialNum'].toString():"无原交易单号",style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                //   ],
                // ),
                SizedBox(height: 10.h,),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text("交易时间",style: TextStyle(color:MyColors.textColor,fontSize: 13.sp),),
                    Text(widget.dataMap['createTime'].toString(),style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                  ],
                ),
                SizedBox(height: 10.h,),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text("交易单号",style: TextStyle(color:MyColors.textColor,fontSize: 13.sp),),
                    Text(widget.dataMap['id']!=null?widget.dataMap['id'].toString():"无交易单号",style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                  ],
                ),
                SizedBox(height: 10.h,),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text("商品单号",style: TextStyle(color:MyColors.textColor,fontSize: 13.sp),),
                    Text(widget.dataMap['productId'].toString(),style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                  ],
                ),
              ],
            ),
          )
        ],
      ),
    );
  }
}
